home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / Newswatcher 2.0b22 / NW Source / Source / nntp.h < prev    next >
Encoding:
Text File  |  1994-10-01  |  3.6 KB  |  80 lines  |  [TEXT/MMCC]

  1. typedef Handle NntpStreamHandle;
  2. typedef OSErr (*NntpChunkFunction) (Ptr t, long tLen, Boolean *abort);
  3.  
  4. typedef enum NntpErr {
  5.     nntpNoErr,                /* no error */
  6.     nntpNoSuchGroupErr,        /* no such group or group access restriction */
  7.     nntpNoSuchArticleErr,    /* no such article */
  8.     nntpServerErr,            /* server error */
  9.     nntpOSErr                /* OS error */
  10. } NntpErr;
  11.  
  12. typedef struct NntpStreamOptions {
  13.     short idleTime;            /* stream is automatically closed if idle for this 
  14.                                many minutes, or 0 to disable */
  15.     Boolean useXPAT;        /* true to use XPAT command for searches */
  16.     Boolean sendModeReader;    /* true to send MODE READER command after connect */
  17.     Boolean batchedCmds;    /* true to use batched GROUP commands */
  18.     Boolean newConnection;    /* true to establish new connection before getting
  19.                                group info */
  20.     Boolean authOnConnect;    /* true to authorize on each new connection */
  21.     char username[32];        /* authorization username */
  22.     char password[32];        /* authorization password */
  23. } NntpStreamOptions;
  24.  
  25. typedef struct NntpGroupInfo {
  26.     long offset;            /* offset into strings of group name */
  27.     long first;                /* first article number in group */
  28.     long last;                /* last article number in group */
  29.     long count;                /* estimate of number of articles in group */
  30.     char status;            /* group status, lower case */
  31.     Boolean ok;                /* true if no error when getting group info */
  32. } NntpGroupInfo, *NntpGroupInfoPtr, **NntpGroupInfoHandle;
  33.  
  34. typedef struct NntpHeaderInfo {
  35.     long number;            /* article number */
  36.     long offset;            /* offset into strings of header contents */
  37. } NntpHeaderInfo, *NntpHeaderInfoPtr, **NntpHeaderInfoHandle;
  38.  
  39. Boolean IsLegalBinHexLine (unsigned char *p, long len);
  40. Boolean IsLegalUULine (unsigned char *p, long len);
  41.  
  42. NntpErr NntpOpen (char *host, NntpStreamOptions *options, NntpStreamHandle *stream);
  43. NntpErr NntpClose (NntpStreamHandle stream);
  44. NntpErr NntpAbort (NntpStreamHandle stream);
  45.  
  46. NntpErr NntpIdle (void);
  47.  
  48. NntpErr NntpSetStreamOptions (NntpStreamHandle stream, NntpStreamOptions *options);
  49.  
  50. NntpErr NntpGetGroupList (NntpStreamHandle stream, unsigned long time,
  51.     Boolean needNumbers, NntpGroupInfoHandle *info, Handle *strings, long *numGroups);
  52. NntpErr NntpGetGroupNames (NntpStreamHandle stream, unsigned long time,
  53.     char *statusFilter, Handle *strings, long *numGroups);
  54. NntpErr NntpGetGroupInfo (NntpStreamHandle stream, char *group, 
  55.     long *first, long *last, long *count);
  56. NntpErr NntpGetMultipleGroupInfo (NntpStreamHandle stream, NntpGroupInfoHandle info,
  57.     long numGroups, Handle strings);
  58.  
  59. NntpErr NntpGetHeaders (NntpStreamHandle stream, char *group, long first, long last,
  60.     char *header, char *pattern,
  61.     void (*buildXPAT)(char *pattern, char *regExp, short regExpLen),
  62.     Boolean (*matchPattern)(char *pattern, char *string),
  63.     NntpHeaderInfoHandle *info, Handle *strings, long *numHeaders);
  64.  
  65. NntpErr NntpGetArticle (NntpStreamHandle stream, char *group, long number, 
  66.     char *id, char *part, Boolean truncateIfAttachedFile, 
  67.     Boolean requireEncodedTextBeginLine, Handle *text,
  68.     Boolean *attachedFile);
  69. NntpErr NntpGetChunkyArticle (NntpStreamHandle stream, char *group, long number, 
  70.     char *id, char *part, NntpChunkFunction chunkFunction, Boolean *aborted);
  71. NntpErr NntpPostArticle (NntpStreamHandle stream, Handle text, Boolean *postIndeterminate);
  72. NntpErr NntpAuthorize (NntpStreamHandle stream, char *username, char *password);
  73.  
  74. NntpErr NntpGetHello (NntpStreamHandle stream, CStr255 msg);
  75. NntpErr NntpGetHelp (NntpStreamHandle stream, Handle *text);
  76. NntpErr NntpGetIPAddr (NntpStreamHandle stream, unsigned long *ipAddr);
  77.  
  78. void NntpGetServerErrInfo (CStr255 cmd, long *num, CStr255 msg);
  79. OSErr NntpGetOSErr (void);
  80.